#define XLBLK_RESPONSE_IRQ _EVENT_BLK_RESP
#define DEBUG_IRQ _EVENT_DEBUG
-#define PARTN_SHIFT 4
-
static blk_ring_t *blk_ring;
static unsigned int resp_cons; /* Response consumer for comms ring. */
static unsigned int req_prod; /* Private request producer. */
switch ( MAJOR(xldev) )
{
case XLIDE_MAJOR:
- physdev = XENDEV_IDE;
+ physdev = XENDEV_IDE + (MINOR(xldev) >> XLIDE_PARTN_SHIFT);
break;
case XLSCSI_MAJOR:
- physdev = XENDEV_SCSI;
+ physdev = XENDEV_SCSI + (MINOR(xldev) >> XLSCSI_PARTN_SHIFT);
break;
case XLVIRT_MAJOR:
- physdev = XENDEV_VIRTUAL;
+ physdev = XENDEV_VIRTUAL + (MINOR(xldev) >> XLVIRT_PARTN_SHIFT);
break;
}
if ( physdev == 0 ) BUG();
- physdev += (MINOR(xldev) >> PARTN_SHIFT);
-
return physdev;
}
static inline xl_disk_t *xldev_to_xldisk(kdev_t xldev)
{
struct gendisk *gd = xldev_to_gendisk(xldev);
- return (xl_disk_t *)gd->real_devices + (MINOR(xldev) >> PARTN_SHIFT);
+ return (xl_disk_t *)gd->real_devices +
+ (MINOR(xldev) >> PARTN_SHIFT(xldev));
}
struct gendisk *gd = xldev_to_gendisk(dev);
xl_disk_t *disk = xldev_to_xldisk(dev);
unsigned long flags;
- int i;
+ int i, partn_shift = PARTN_SHIFT(dev);
spin_lock_irqsave(&io_request_lock, flags);
if ( disk->usage > 1 )
}
spin_unlock_irqrestore(&io_request_lock, flags);
- for ( i = 0; i < (1 << PARTN_SHIFT); i++ )
+ for ( i = 0; i < (1 << partn_shift); i++ )
{
invalidate_device(dev + i, 1);
gd->part[dev + i].start_sect = 0;
gd->part[dev + i].nr_sects = 0;
}
- grok_partitions(gd, MINOR(dev) >> PARTN_SHIFT,
- 1 << PARTN_SHIFT, disk->capacity);
+ grok_partitions(gd, MINOR(dev) >> partn_shift,
+ 1 << partn_shift, disk->capacity);
return 0;
}
#define DPRINTK_IOCTL(_f, _a...) ((void)0)
#endif
+/* IDE/SCSI have <= 32 partitions per device. VIRT has <= 16. */
+#define PARTN_SHIFT(_dev) ((MAJOR(_dev)==XLVIRT_MAJOR) ? 4 : 5)
+#define XLIDE_PARTN_SHIFT 5
+#define XLSCSI_PARTN_SHIFT 5
+#define XLVIRT_PARTN_SHIFT 4
+
/*
* We have one of these per XL-IDE, XL-SCSI, and XL-VIRT device.
* They hang in an array off the gendisk structure. We may end up putting
/* We support up to 16 devices of up to 16 partitions each. */
#define XLIDE_MAX 256
#define XLIDE_MAJOR_NAME "xhd"
-#define IDE_PARTN_BITS 4
static int xlide_blksize_size[XLIDE_MAX];
static int xlide_hardsect_size[XLIDE_MAX];
static int xlide_max_sectors[XLIDE_MAX];
*/
blk_queue_headactive(BLK_DEFAULT_QUEUE(XLIDE_MAJOR), 0);
- /* We may register up to 16 devices in a sparse identifier space. */
- units = 16;
+ units = XLIDE_MAX >> XLIDE_PARTN_SHIFT;
/* Construct an appropriate gendisk structure. */
- minors = units * (1<<IDE_PARTN_BITS);
+ minors = units * (1<<XLIDE_PARTN_SHIFT);
gd = kmalloc(sizeof(struct gendisk), GFP_KERNEL);
gd->sizes = kmalloc(minors * sizeof(int), GFP_KERNEL);
gd->part = kmalloc(minors * sizeof(struct hd_struct), GFP_KERNEL);
gd->major = XLIDE_MAJOR;
gd->major_name = XLIDE_MAJOR_NAME;
- gd->minor_shift = IDE_PARTN_BITS;
- gd->max_p = 1<<IDE_PARTN_BITS;
+ gd->minor_shift = XLIDE_PARTN_SHIFT;
+ gd->max_p = 1<<XLIDE_PARTN_SHIFT;
gd->nr_real = units;
gd->real_devices = kmalloc(units * sizeof(xl_disk_t), GFP_KERNEL);
gd->next = NULL;
((xl_disk_t *)gd->real_devices)[disk].capacity =
xdi->disks[i].capacity;
register_disk(gd,
- MKDEV(XLIDE_MAJOR, disk<<IDE_PARTN_BITS),
- 1<<IDE_PARTN_BITS,
+ MKDEV(XLIDE_MAJOR, disk<<XLIDE_PARTN_SHIFT),
+ 1<<XLIDE_PARTN_SHIFT,
&xlide_block_fops,
xdi->disks[i].capacity);
}
/* We support up to 16 devices of up to 16 partitions each. */
#define XLSCSI_MAX 256
#define XLSCSI_MAJOR_NAME "xsd"
-#define SCSI_PARTN_BITS 4
static int xlscsi_blksize_size[XLSCSI_MAX];
static int xlscsi_hardsect_size[XLSCSI_MAX];
static int xlscsi_max_sectors[XLSCSI_MAX];
*/
blk_queue_headactive(BLK_DEFAULT_QUEUE(XLSCSI_MAJOR), 0);
- /* We may register up to 16 devices in a sparse identifier space. */
- units = 16;
+ units = XLSCSI_MAX >> XLSCSI_PARTN_SHIFT;
/* Construct an appropriate gendisk structure. */
- minors = units * (1<<SCSI_PARTN_BITS);
+ minors = units * (1<<XLSCSI_PARTN_SHIFT);
gd = kmalloc(sizeof(struct gendisk), GFP_KERNEL);
gd->sizes = kmalloc(minors * sizeof(int), GFP_KERNEL);
gd->part = kmalloc(minors * sizeof(struct hd_struct), GFP_KERNEL);
gd->major = XLSCSI_MAJOR;
gd->major_name = XLSCSI_MAJOR_NAME;
- gd->minor_shift = SCSI_PARTN_BITS;
- gd->max_p = 1<<SCSI_PARTN_BITS;
+ gd->minor_shift = XLSCSI_PARTN_SHIFT;
+ gd->max_p = 1<<XLSCSI_PARTN_SHIFT;
gd->nr_real = units;
gd->real_devices = kmalloc(units * sizeof(xl_disk_t), GFP_KERNEL);
gd->next = NULL;
((xl_disk_t *)gd->real_devices)[disk].capacity =
xdi->disks[i].capacity;
register_disk(gd,
- MKDEV(XLSCSI_MAJOR, disk<<SCSI_PARTN_BITS),
- 1<<SCSI_PARTN_BITS,
+ MKDEV(XLSCSI_MAJOR, disk<<XLSCSI_PARTN_SHIFT),
+ 1<<XLSCSI_PARTN_SHIFT,
&xlscsi_block_fops,
xdi->disks[i].capacity);
}
/* We support up to 16 devices of up to 16 partitions each. */
#define XLVIRT_MAX 256
#define XLVIRT_MAJOR_NAME "xvd"
-#define VIRT_PARTN_BITS 4
static int xlseg_blksize_size[XLVIRT_MAX];
static int xlseg_hardsect_size[XLVIRT_MAX];
static int xlseg_max_sectors[XLVIRT_MAX];
*/
blk_queue_headactive(BLK_DEFAULT_QUEUE(XLVIRT_MAJOR), 0);
- /*
- * We may register up to 16 devices in a sparse identifier space.
- * Unlike with IDE and SCSI, we always register a gendisk, as new
- * virtual devices may get allocate dto us later on.
- */
- units = 16;
+ units = XLVIRT_MAX >> XLVIRT_PARTN_SHIFT;
/* Construct an appropriate gendisk structure. */
- minors = units * (1<<VIRT_PARTN_BITS);
+ minors = units * (1<<XLVIRT_PARTN_SHIFT);
gd = kmalloc(sizeof(struct gendisk), GFP_KERNEL);
gd->sizes = kmalloc(minors * sizeof(int), GFP_KERNEL);
gd->part = kmalloc(minors * sizeof(struct hd_struct), GFP_KERNEL);
gd->major = XLVIRT_MAJOR;
gd->major_name = XLVIRT_MAJOR_NAME;
- gd->minor_shift = VIRT_PARTN_BITS;
- gd->max_p = 1<<VIRT_PARTN_BITS;
+ gd->minor_shift = XLVIRT_PARTN_SHIFT;
+ gd->max_p = 1<<XLVIRT_PARTN_SHIFT;
gd->nr_real = units;
gd->real_devices = kmalloc(units * sizeof(xl_disk_t), GFP_KERNEL);
gd->next = NULL;
((xl_disk_t *)gd->real_devices)[disk].capacity =
xdi->disks[i].capacity;
register_disk(gd,
- MKDEV(XLVIRT_MAJOR, disk<<VIRT_PARTN_BITS),
- 1<<VIRT_PARTN_BITS,
+ MKDEV(XLVIRT_MAJOR, disk<<XLVIRT_PARTN_SHIFT),
+ 1<<XLVIRT_PARTN_SHIFT,
&xlsegment_block_fops,
xdi->disks[i].capacity);
}
#define UMEM_MAJOR 116 /* http://www.umem.com/ Battery Backed RAM */
/*
- * Each of these majors supports up to 16 devices of <= 16 partitions each.
- * eg. xhda == (123, 0), xhdb == (123, 16), ...
- * xsda == (124, 0), xsdb == (124, 16), ...
+ * XLIDE/XLSCSI each support up to 8 devices of <= 32 partitions each.
+ * XLVIRT supports 16 devices of <= 16 partitions each.
+ * eg. xhda == (123, 0), xhdb == (123, 32), ...
+ * xsda == (124, 0), xsdb == (124, 32), ...
* xvda == (125, 0), xvdb == (125, 16), ...
*/
#define XLIDE_MAJOR 123 /* XenoLinux IDE Device */
{ "ataraid/d15p",0x72F0 },
#if defined(CONFIG_XENOLINUX_BLOCK)
/* XenoLinux IDE Devices */
- { "xhda", 0x7B00 }, { "xhdb", 0x7B10 },
- { "xhdc", 0x7B20 }, { "xhdd", 0x7B30 },
- { "xhde", 0x7B40 }, { "xhdf", 0x7B50 },
- { "xhdg", 0x7B60 }, { "xhdh", 0x7B70 },
- { "xhdi", 0x7B80 }, { "xhdj", 0x7B90 },
- { "xhdk", 0x7BA0 }, { "xhdl", 0x7BB0 },
- { "xhdm", 0x7BC0 }, { "xhdn", 0x7BD0 },
- { "xhdo", 0x7BE0 }, { "xhdp", 0x7BF0 },
+ { "xhda", 0x7B00 }, { "xhdb", 0x7B20 },
+ { "xhdc", 0x7B40 }, { "xhdd", 0x7B60 },
+ { "xhde", 0x7B80 }, { "xhdf", 0x7BA0 },
+ { "xhdg", 0x7BC0 }, { "xhdh", 0x7BE0 },
/* Xenolinux SCSI Devices */
- { "xsda", 0x7C00 }, { "xsdb", 0x7C10 },
- { "xsdc", 0x7C20 }, { "xsdd", 0x7C30 },
- { "xsde", 0x7C40 }, { "xsdf", 0x7C50 },
- { "xsdg", 0x7C60 }, { "xsdh", 0x7C70 },
- { "xsdi", 0x7C80 }, { "xsdj", 0x7C90 },
- { "xsdk", 0x7CA0 }, { "xsdl", 0x7CB0 },
- { "xsdm", 0x7CC0 }, { "xsdn", 0x7CD0 },
- { "xsdo", 0x7CE0 }, { "xsdp", 0x7CF0 },
+ { "xsda", 0x7C00 }, { "xsdb", 0x7C20 },
+ { "xsdc", 0x7C40 }, { "xsdd", 0x7C60 },
+ { "xsde", 0x7C80 }, { "xsdf", 0x7CA0 },
+ { "xsdg", 0x7CC0 }, { "xsdh", 0x7CE0 },
/* XenoLinux Virtual Devices */
{ "xvda", 0x7D00 }, { "xvdb", 0x7D10 },
{ "xvdc", 0x7D20 }, { "xvdd", 0x7D30 },